import {
  aJ as d,
  aK as p,
  q as n,
  p as O,
  ap as T,
  X as C,
  f as _,
  H as R,
  av as S,
  aw as j,
  k as i,
  m as B,
  l as W,
  as as o,
  at as b
} from "./index-30f27935.js";
const J = t => d.request("post", p("notice/list"), { data: t }),
  E = t => d.request("post", p("notice/info"), { data: t }),
  K = t => d.request("post", p("notice/update"), { data: t }),
  F = t => d.request("post", p("notice/delete"), { data: t });
function H(t) {
  const f = n([]),
    s = n(!0);
  n({}), O();
  const g = n(1),
    h = n(10),
    w = n();
  n(!1);
  const k = T("reload"),
    m = C({
      pageSize: 10,
      currentPage: 1,
      pageSizes: [10, 20, 30],
      total: 0,
      align: "right",
      background: !0,
      small: !1
    }),
    I = C({
      text: "正在加载第一页...",
      viewBox: "-10, -10, 50, 50",
      spinner: `
        <path class="path" d="
          M 30 15
          L 28 17
          M 25.61 25.61
          A 15 15, 0, 0, 1, 15 30
          A 15 15, 0, 1, 1, 27.99 7.5
          L 15 15
        " style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/>
      `
    }),
    z = [
      {
        type: "selection",
        width: 55,
        align: "left",
        hide: ({ checkList: e }) => !e.includes("勾选列")
      },
      {
        label: "序号",
        type: "index",
        width: 70,
        hide: ({ checkList: e }) => !e.includes("序号列")
      },
      { label: "ID", prop: "id", minWidth: 100 },
      { label: "标题", prop: "title", minWidth: 120 },
      { label: "阅读人数", prop: "count", minWidth: 120 },
      { label: "云值", prop: "value", minWidth: 120 },
      {
        label: "分类",
        prop: "type",
        minWidth: 150,
        cellRenderer: e =>
          i("div", null, [
            " ",
            e.row.type == 1
              ? "平台公告"
              : e.row.type == 2
              ? "商学院"
              : e.row.type == 3
              ? "平台资讯"
              : "素材分享"
          ])
      },
      {
        label: "展示",
        prop: "show",
        minWidth: 120,
        formatter: ({ show: e }) =>
          e == 1
            ? i(
                W("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => [B("展示")] }
              )
            : i(
                W("el-tag"),
                { class: "mx-1", type: "danger", effect: "light" },
                { default: () => [B("不展示")] }
              )
      },
      {
        label: "图片",
        prop: "img",
        minWidth: 100,
        cellRenderer: e =>
          i("div", null, [
            " ",
            i(
              "img",
              { src: e.row.img, style: "width: 100%; height: 100%;", alt: "" },
              null
            )
          ])
      },
      { label: "创建时间", minWidth: 180, prop: "create_time" },
      { label: "操作", fixed: "right", width: 200, slot: "operation" }
    ],
    A = _(() => [
      "!h-[20px]",
      "reset-margin",
      "!text-gray-500",
      "dark:!text-white",
      "dark:hover:!text-primary"
    ]);
  async function D(e) {
    const l = { id: e.id },
      r = JSON.stringify(l),
      c = { value: o.enc.Base64.stringify(o.enc.Utf8.parse(r)) },
      a = await F(c);
    a.code == 200
      ? (b("删除成功", { type: "success" }), k())
      : b(a.msg, { type: "error" });
  }
  function U() {}
  function V(e) {
    (h.value = e), y(void 0, e);
  }
  function q(e) {
    (g.value = e), y(e, void 0);
  }
  function L(e) {}
  function M(e) {
    (I.text = `正在加载第${e}页...`),
      (s.value = !0),
      S(600).then(() => {
        s.value = !1;
      });
  }
  async function x(e) {
    (s.value = !0), (w.value = e);
    const l = { page: g.value, pagesize: h.value, type: e },
      r = JSON.stringify(l),
      c = { value: o.enc.Base64.stringify(o.enc.Utf8.parse(r)) },
      { data: a } = await J(c);
    (f.value = a.data),
      (m.total = a.total),
      setTimeout(() => {
        s.value = !1;
      }, 500);
  }
  async function y(e = g.value, l = h.value) {
    const r = { page: e, pagesize: l, type: w.value },
      v = JSON.stringify(r),
      a = { value: o.enc.Base64.stringify(o.enc.Utf8.parse(v)) },
      u = await J(a);
    u.code === 200
      ? ((f.value = u.data.data),
        (m.total = u.data.total),
        setTimeout(() => {
          s.value = !1;
        }, 500))
      : b(u.msg, { type: "error" });
  }
  const N = e => {
    e && (e.resetFields(), x());
  };
  return (
    R(() => {
      S().then(() => {
        const { setWatermark: e } = j(t.value.getTableDoms().tableWrapper);
        e("后台项目", {
          font: "16px Microsoft YaHei",
          globalAlpha: 0.8,
          forever: !0,
          width: 252,
          height: 80
        });
      }),
        y();
    }),
    {
      loading: s,
      columns: z,
      dataList: f,
      pagination: m,
      buttonClass: A,
      onSearch: x,
      resetForm: N,
      handleaddUser: U,
      handleDelete: D,
      handleSizeChange: V,
      handleCurrentChange: q,
      handleSelectionChange: L,
      onCurrentChange: M
    }
  );
}
const X = Object.freeze(
  Object.defineProperty({ __proto__: null, useRole: H }, Symbol.toStringTag, {
    value: "Module"
  })
);
export { K as a, X as h, E as n, H as u };
